package acm;

import java.util.Random;

public class Ch01 {
    /**
     * 第一次作业
     */
    public static void main(String[] args) {
        Random random=new Random();
        for (int i=1;i<=50;i++){
            int a = random.nextInt(100);
            int b = random.nextInt(100);
            fun(Math.max(a,b),Math.min(a,b));
            if (i%10==0){
                System.out.println();
            }
        }
    }

    public static void fun(int max,int min){
        boolean flag=max+min<100;   //是否做加法
        String symbol=flag?"+":"-";
        int res=flag?max+min:max-min;
        System.out.print(String.format("%2d",max)+symbol+String.format("%2d",min)+"="+String.format("%2d",res)+"\t");
    }
}
